In [2]:
%load_ext rmagic

Necessary Sample Sizes


In [7]:
%%R
number_of_samples <- 3000
control_conversion_rate <- 0.27
variation_conversion_rate <- 0.3

simulation_results <- mapply(function(x){
    control <- factor(rbinom(number_of_samples, 1, variation_conversion_rate) == T)
    results <- binom.test(length(control[control == T]), number_of_samples, control_conversion_rate)
    .05 >= results[3]$p.value
}, seq(0, 5000, by=1))

percent_of_time_equivalent <- length(simulation_results[simulation_results==TRUE]) / length(simulation_results)
print(percent_of_time_equivalent)


[1] 0.9496101